package ihm.manes_ho.agenda.vo;

/**
 * This class represents a rendez-vous entity
 */
public class MeetingVO {
	private String name;
	private String address;
	private int weekday_index; //0 -> Monday; 1-> Tuesday; ... ; 6 -> Sunday
	private int timeStart;
	private int timeEnd;
	
	//bidirectional..
	private MeetingItemVO meetingItem;
	
	public MeetingVO() {
	}
	
	public MeetingVO(String name, String address, int weekday_index, int timeStart, int timeEnd) {
		this.name = name;
		this.address = address;
		this.weekday_index = weekday_index;
		this.timeStart = timeStart;
		this.timeEnd = timeEnd;
	}
	
	public void setMeetingItem(MeetingItemVO meetingItem) {
		this.meetingItem = meetingItem;
	}
	
	public MeetingItemVO getMeetingItem() {
		return meetingItem;
	}
	
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}
	
	public int getWeekday_index() {
		return weekday_index;
	}
	
	public void setWeekday_index(int weekdayIndex) {
		weekday_index = weekdayIndex;
	}
	
	public int getTimeStart() {
		return timeStart;
	}

	public void setTimeStart(int timeStart) {
		this.timeStart = timeStart;
	}
	
	public int getTimeEnd() {
		return timeEnd;
	}
	
	public void setTimeEnd(int timeEnd) {
		this.timeEnd = timeEnd;
	}
	
	@Override
	public String toString() {
		return name;
	}
	
	@Override
	public boolean equals(Object o) {
		if (!(o instanceof MeetingVO))
			return false;
		
		if (this.getName().equals(((MeetingVO) o).getName())
				&& this.getTimeStart() == ((MeetingVO) o).getTimeStart()
				&& this.getTimeEnd() == ((MeetingVO) o).getTimeEnd())
			return true;
		
		return false;
	}
	
	@Override
	public int hashCode() {
		return getName().hashCode() + getTimeStart() + getTimeEnd();
	}
}
